from urllib import parse, request
import json
# import time

def get_caller(input_url, func):
    func(input_url)

def get_method(input_url):
    print(input_url)
    res_data = request.urlopen(input_url)
    res = res_data.read()
    res_string = str(res, encoding="utf-8")
    res_json = json.loads(res_string)
    print('********************' + str(res_json))

url = 'http://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/v1'
match_id_num = 3567996028
number_of_match = 1000

for i in range(number_of_match):
    param = {'match_id': str(match_id_num+i), 'key': 'EFA1E81676FCC47157EA871A67741EF5'}
    param = parse.urlencode(param)
    url_counter = url + '?' + param
    get_caller(url_counter, get_method)
    # time.sleep(5)

# print(url)
